﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using WB.Library;
using Bussiness.Manager;
public partial class Control_ProductDetail : System.Web.UI.UserControl
{

    private int PRoductID
    {
        get
        {
            return (Request["PRODID"] ==null ?-1 : !string.IsNullOrEmpty(Request["PRODID"].ToString()) == true ? Int32.Parse(Request["PRODID"]) : -1);
        }
    }

    public int INTID {
        get {
            return (Request["CATEGORYID"] == null ? -1 : Int32.Parse(Request["CATEGORYID"].ToString()));
        }
    }

    public string GetTextID(string text)
    {
        return WB.Library.UnicodeConversion.CreateInstant().GetStringId(text);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadDetail();
            LoadRepParentData();
        }
    }

    private void LoadDetail(){

        DataTable tab = CmsProductsManager.CreateInstant().GetProductInfoID(PRoductID);
        if (tab != null && tab.Rows.Count > 0)
        {
            repDetail.DataSource = tab;
            repDetail.DataBind();
        }
    }

    private void LoadRepParentData()
    {
        DataTable tabCategory = CmsProductsManager.CreateInstant().GetProductByCategoryTOP(INTID, "vi-VN", string.Empty, PRoductID);
        if (tabCategory != null && tabCategory.Rows.Count > 0)
        {
            repChildren.DataSource = tabCategory;
            repChildren.DataBind();
        }

    }
}
